﻿using System;
using System.Windows;

namespace WPFDataEditors.ProgressBar.Control
{
    public class ProgressBar:System.Windows.Controls.ProgressBar
    {

        #region Fields

        private static readonly Uri ControlThemeuri = new Uri("/WPFDataEditors;component/ProgressBar/Themes/Generic.xaml", UriKind.Relative);
        private readonly ResourceDictionary _controlThemeStyle = new ResourceDictionary { Source = ControlThemeuri };

        #endregion

        #region Constructor

        public ProgressBar()
        {
            DataContext = this;
            AddResouces();
        }

        #endregion

        #region Properties

        public string Content
        {
            get { return (string)GetValue(ContentProperty); }
            set
            {
                SetValue(ContentProperty, value);
            }
        }
        public static readonly DependencyProperty ContentProperty = DependencyProperty.Register(
          "Content", typeof(string), typeof(ProgressBar), new PropertyMetadata(null));

        public ProgressBarType ProgressBarType
        {
            get { return (ProgressBarType)GetValue(ProgressBarTypeProperty); }
            set
            {
                SetValue(ProgressBarTypeProperty, value);
            }
        }
        public static readonly DependencyProperty ProgressBarTypeProperty = DependencyProperty.Register(
          "ProgressBarType", typeof(ProgressBarType), typeof(ProgressBar), new PropertyMetadata(ProgressBarType.None));

        #endregion

        #region Commands

        #endregion

        #region CommandHandler

        #endregion

        #region Methods

        private void AddResouces()
        {

            if (!UriParser.IsKnownScheme("pack"))
                UriParser.Register(new GenericUriParser(GenericUriParserOptions.GenericAuthority), "pack", -1);


            //Datagrid
            if (!Resources.MergedDictionaries.Contains(_controlThemeStyle))
                Resources.MergedDictionaries.Add(_controlThemeStyle);
        }

        #endregion

        #region Events

        #endregion
       
    }

    public enum ProgressBarType
    {
        Content=0,
        Value=1,
        Ratio=2,
        Percentage=4,
        None
    }
}
